#import <Cocoa/Cocoa.h>
#import "ManagingWindowController.h"

@class SourceListViewController;
@class DetailViewController;
@class RNToolbarViewController;
@class RNNewItemSheetController;
@class RNPreferencesController;
@class RNToolbar;
@class RNNewListItemSheetController;

@interface MainWindowController : ManagingWindowController <NSWindowDelegate> {    
    NSView *sourceListContentView_;
    NSView *detailContentView_;
    NSView *mainSplitRightView_;
    NSSplitView *mainSplitView_;
    NSMenu *applicationSearchMenu_;
    NSSearchField *searchField_;
//    NSTimer *completedItemsTimer_;
    
    // Toolbar
    RNToolbarViewController *toolbarViewController_;
    RNToolbar *toolbar_;
    
    // Navigation Bar
    NSPathControl *pathControl_;
    NSPopUpButton *storeFilterPopUp_;
    NSArrayController *storeFilterArrayController_;
    NSView *navBar_;
    
    // Prefences Window
    RNPreferencesController *preferencesController_;
    
    SourceListViewController *sourceListViewController_;
    DetailViewController *detailViewController_;
    RNNewItemSheetController *newItemSheetController_;
    RNNewListItemSheetController *newListItemSheetController_;
    id rootObject_;
    NSMutableArray *previousRootObjects_;
    NSMutableArray *nextRootObjects_;
    
    NSArrayController *incompleteListItemsArrayController_;
    NSPredicate *incompleteListItemsFilterPredicate_;
}

@property (nonatomic, assign) IBOutlet NSView *sourceListContentView;
@property (nonatomic, assign) IBOutlet NSView *detailContentView;
@property (nonatomic, assign) IBOutlet NSSplitView *mainSplitView;
@property (nonatomic, assign) IBOutlet NSView *mainSplitRightView;
@property (nonatomic, assign) IBOutlet NSMenu *applicationSearchMenu;
@property (nonatomic, assign) IBOutlet NSSearchField *searchField;
@property (nonatomic, assign) IBOutlet RNToolbar *toolbar;
@property (nonatomic, assign) IBOutlet RNToolbarViewController *toolbarViewController;
@property (nonatomic, retain) SourceListViewController *sourceListViewController;
@property (nonatomic, retain) DetailViewController *detailViewController;
@property (nonatomic, readonly) RNNewItemSheetController *newItemSheetController;
@property (nonatomic, readonly) RNNewListItemSheetController *newListItemSheetController;
@property (nonatomic, retain) id rootObject;
@property (nonatomic, assign) IBOutlet NSArrayController *incompleteListItemsArrayController;
@property (nonatomic, retain) NSPredicate *incompleteListItemsFilterPredicate;

-(IBAction)displayNewItemSheet:(id)sender;
-(IBAction)displayNewItemSheetAndSelectItem:(id)sender;
-(IBAction)toggleShowToolbar:(id)sender;
-(IBAction)applicationSearch:(id)sender;
-(IBAction)toggleFavoriteForSelectedItems:(id)sender;
-(void)applicationDidBecomeActive:(NSNotification *)note;
-(void)applicationDidResignActive:(NSNotification *)note;
-(void)selectRootObject:(id)newRootObject;
//-(void)selectRootObject:(id)newRootObject fromSender:(id)sender;
-(IBAction)selectPreviousRootObject:(id)sender;
-(IBAction)selectNextRootObject:(id)sender;
-(id)previousRootObject;
-(id)nextRootObject;

#pragma mark -
#pragma mark Completed Items Autologger
typedef enum {
    RNLogCompletedItemsImmediately,
    RNLogCompletedItemsDaily,
    RNLogCompletedItemsWeekly,
    RNLogCompletedItemsMonthly,
    RNLogCompletedItemsManually
} RNLogCompletedItemsInterval;

-(void)autologCompletedItems;
-(void)autoClearHistoryItems;


#pragma mark -
#pragma mark Navigation Bar
@property (nonatomic, assign) IBOutlet NSPathControl *pathControl;
@property (nonatomic, assign) IBOutlet NSView *navBar;
@property (nonatomic, assign) IBOutlet NSPopUpButton *storeFilterPopUp;
@property (nonatomic, assign) IBOutlet NSArrayController *storeFilterArrayController;


#pragma mark -
#pragma mark Preferences Window
@property (nonatomic, assign) RNPreferencesController *preferencesController;
-(IBAction)applicationPreferences:(id)sender;

@end
